package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;

<#if customPageConfig.existSearchField>
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.util.ObjectUtils;
import java.util.List;
</#if>

/**
 * <p>
 * ${customTableInfo.businessName!table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 * @version ${version}
 */
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {

}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
<#if customPageConfig.existSearchField>
   @Override
   public IPage<${entity}> page(int current, int size, ${entity} domain) {
     IPage<${entity}> page = new Page<>(current, size);
     return lambdaQuery()
     <#list  customTableInfo.tableFieldConfig as field>
      <#if field.isQuery && field.queryModeSelect??>
            .${field.queryModeSelect}(!ObjectUtils.isEmpty(domain.get${field.propertyName?cap_first}()), ${entity}::get${field.propertyName?cap_first}, domain.get${field.propertyName?cap_first}())
      </#if>
     </#list>
            .page(page);
   }

    @Override
    public List<${entity}> list( ${entity} domain) {
      return lambdaQuery()
      <#list  customTableInfo.tableFieldConfig as field>
        <#if field.isQuery && field.queryModeSelect??>
            .${field.queryModeSelect}(!ObjectUtils.isEmpty(domain.get${field.propertyName?cap_first}()), ${entity}::get${field.propertyName?cap_first}, domain.get${field.propertyName?cap_first}())
        </#if>
     </#list>
            .list();
    }
</#if>


}
</#if>
